<div class="article_space"></div>
    <div id="Searchresult">Here</div>
    <div id="Pagination" class="pagination"></div>

{script}

    function pageselectCallback(page_index, jq){
        // Get number of elements per pagionation page from form
        var items_per_page = 10;
        var max_elem = Math.min((page_index+1) * items_per_page, members.length);
        var newcontent = '';

        // Iterate through a selection of the content and build an HTML string
        for(var i=page_index*items_per_page;i < max_elem;i++)
        {
            newcontent += members[i];
        }

        // Replace old content with new content
        $('#Searchresult').html(newcontent);

        // Prevent click eventpropagation
        return false;
    }

    function getOptionsFromForm(){
        var opt = {callback: pageselectCallback};
        // Collect options from the text fields - the fields are named like their option counterparts
        $("input:text").each(function(){
            opt[this.name] = this.className.match(/numeric/) ? parseInt(this.value) : this.value;
        });
        // Avoid html injections in this demo
        var htmlspecialchars ={ "&":"&amp;", "<":"&lt;", ">":"&gt;", '"':"&quot;"}
        $.each(htmlspecialchars, function(k,v){
            opt.prev_text = opt.prev_text.replace(k,v);
            opt.next_text = opt.next_text.replace(k,v);
        })
        return opt;
    }


    $(document).ready(function(){
        var per_page = 10;
        // Create pagination element with options from form
        //var optInit = getOptionsFromForm();
        $("#Pagination").pagination(members.length, {
            items_per_page:per_page,
            callback:pageselectCallback,
            num_display_entries:7,
            num_edge_entries:2,
            prev_text:"Trước",
            next_text:"Sau"
        });

        if(members.length < per_page){
            document.getElementById("Pagination").style.display = "none";
        }


    });



</script>
